home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1450 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.1 KB  |  52 lines

  1. Newsgroups: comp.lang.c++
  2. Path: merlin.hgc.edu!weat4122
  3. From: weat4122@hgc.edu (gerard weatherby)
  4. Subject: Re: help on syntax
  5. Message-ID: <1996Jan11.021442.24336@merlin.hgc.edu>
  6. Sender: usenet@merlin.hgc.edu (Action News Central)
  7. Organization: The Hartford Graduate Center
  8. References: <4cd5io$7qg@news1.usa.pipeline.com>
  9. Date: Thu, 11 Jan 1996 02:14:42 GMT
  10.  
  11. In article <4cd5io$7qg@news1.usa.pipeline.com> grantp@usa.pipeline.com(Pete) writes:
  12. >On Jan 02, 1996 22:27:28 in article <help on syntax>, 'Paul Abrilla
  13. ><APCCU@CUNYVM.CUNY.EDU>' wrote: 
  14. >>I'm trying to run a simple program, but I'm getting a 'misplaced 
  15. >>else' error everytime I compile it.  [... rest deleted ..] 
  16. >Read up on the use of braces. 
  17. >> 
  18. >>if (c = (a-b)) 
  19. >   {  // Ya needs one here 
  20. >>cout << "a: "; 
  21. >>cout << a; 
  22. >>cout << " minus b: "; 
  23. >>cout << b; 
  24. >>cout << " quals c: "; 
  25. >>cout << c << endl; 
  26. >  }  // and here 
  27. >>else 
  28. >>cout << "a-b does not equal c: " << endl; 
  29. >> 
  30. >-- 
  31. >Pete 
  32. >
  33. ---------
  34. or more simply...
  35.  
  36. if (c == (a-b)) 
  37.     cout << "a: " 
  38.         << a 
  39.         << " minus b: " 
  40.         << b 
  41.         << " quals c: " 
  42.         << c << endl; 
  43. else 
  44.     cout << "a-b does not equal c: " << endl; 
  45.  
  46.  
  47.